const o = {
  _age: 123,
  name: "John",
  birthday: new Date("2000-1-2 13:33:12"),
};
const s = JSON.stringify(o);
console.log(s); // {"_age":123,"name":"John","birthday":"2000-01-02T05:33:12.000Z"}
console.log(JSON.parse(s)); // { _age: 123, name: 'John', birthday: '2000-01-02T05:33:12.000Z' }
const data = JSON.parse(s, function (key, value) {
  // 删除以下划线开头的属性和值
  if (key[0] === "_") return undefined;
  // 如果值是 ISO 8601 格式的日期字符串，则转换为 Date
  if (
    typeof value === "string" &&
    /^\d\d\d\d-\d\d-\d\dT\d\d:\d\d:\d\d.\d\d\dZ/.test(value)
  ) {
    return new Date(value);
  }
  // 否则返回原始值
  return value;
});
console.log(data); // { name: 'John', birthday: 2000-01-02T05:33:12.000Z }
